// 1037 在霍格沃茨找零钱
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

#define x first
#define y second
using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
const int N = 1e5 + 10;

int P[3], A[3];

int main()
{
	scanf("%d.%d.%d", &P[0], &P[1], &P[2]);
	scanf("%d.%d.%d", &A[0], &A[1], &A[2]);
	
	int p = P[0] * 17 * 29 + P[1] * 29 + P[2];
	int a = A[0] * 17 * 29 + A[1] * 29 + A[2];
	if(p > a) {
		int sum = p - a;
		printf("-%d.%d.%d", sum / (17 * 29), (sum % (17 * 29)) / 29, sum % 29);
	}else {
		int sum = a - p;
		printf("%d.%d.%d", sum / (17 * 29), (sum % (17 * 29)) / 29, sum % 29);
	}

	return 0;
}